<template>
<div>
<iframe
        class="child"
        frameborder="0"
        :src="
          '/pdf/web/viewer.html?file=' +
            this.downloadUrl
        "
        :style="{ width: width, height: height }"
      >
    </iframe></div>
  
</template>
 
<script>
import { getPdf } from "api/jscsdpg.js";

export default {
  data() {
    return {
      multipleSelection: [],
      visible: this.show,
      downloadUrl: 'http://192.168.0.118:8080/jeecg-boot/fjb/pdf'

};
  },
  props: {
    show: {
      type: Boolean,
      default: false,
    },
  },
  watch: {
    show() {
      this.visible = this.show;
    },
  },
  methods: {
    onLineReadPDF() {
         getPdf().then((res) => {
        this.getObjectURL(res)
         
      });
    },

    getObjectURL(file) {
      let url = null;
      if (window.createObjectURL != undefined) { // basic
          url = window.createObjectURL(file);
      } else if (window.webkitURL != undefined) { // webkit or chrome
          try {
            url = window.webkitURL.createObjectURL(file);            
          } catch (error) {
            
          }
      } else if (window.URL != undefined) { // mozilla(firefox)
        try {
          url = window.URL.createObjectURL(file);
        } catch (error) {
          
        }
      }
      return url;
    },
    close() {
      this.$emit("close1");
    },
    ok() {
      this.$emit("ok1", this.multipleSelection);
    },
  },
  mounted() {},
};
</script>
 <style>
.customWidth {
  width: 80%;
}
</style>
